<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>学生管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			/*重置*/
			$("#btnReset").click(function () {
				$("#schoolCodeId").val("");
				$("#schoolCodeName").val("");
				$("#classCodeId").val("");
				$("#classCodeName").val("");
				$("#beginDate").val("");
				$("#endDate").val("");
				$("#stuCode").val("");
				$("#stuGrade").val("").select2();
				$("#gender").val("").select2();
			});
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
	</script>
	<style type="text/css">
		.minWidth {
			min-width: 177px;
		}	
		.autoWidth {
		    width: auto;
		}	
		.select2-choices{
		    border-radius: 4px;
		}	
		#contentTable td ,#contentTable th{
			text-align: center;
			padding: 1px 20px;
		}
		#contentTable tbody tr td{
			font-size: 13px;
		}
   </style>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/student/student/">学生列表</a></li>
		<shiro:hasPermission name="student:student:edit"><li><a href="${ctx}/student/student/form">学生添加</a></li></shiro:hasPermission>
	</ul>
	<form:form id="searchForm" modelAttribute="student" action="${ctx}/student/student/" method="post" class="breadcrumb form-search" autocomplete="off">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<div class="breadcrumb">
			<table class="table table-bordered">
				<tr>
				    <th>学校：</th>
					<td>
						<sys:treeselect2 id="schoolCode" name="schoolCode" value="${student.schoolCode}" labelName="schoolName" labelValue="${student.schoolName}"
			                title="学校" url="/sysschool/sysSchool/schTreeData" cssClass="input-medium" layer = "true" notAllowSelectParent="true" notAllowSelectRoot="true"/>
					</td>
					<th>班级：</th>
					<td>
						<sys:treeselect2 id="classCode" name="classCode" value="${student.classCode}" labelName="className" labelValue="${student.className}"
			                title="学校" url="/classinfo/classInfo/classTreeData" cssClass="input-medium" layer = "true" notAllowSelectParent="true" notAllowSelectRoot="true"/>
					</td>
					<th>姓名：</th>
					<td>
						<form:input path="stuName" id="stuName" class="span2 minWidth"/>
					</td>
				</tr>
				<tr>
					<th>学号：</th>
					<td>
						<form:input path="stuCode" id="stuCode" class="span2 minWidth"/>
					</td>
				    <th>性别：</th>
					<td colspan="3">
						<form:select path="gender" id ="gender" class="span2 minWidth">
							<form:option value="" label="--请选择--"/>
							<form:options items="${fns:getDictList('sex')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
						</form:select>
					</td>
				</tr>
				<tr>
					<th>出生起始日期：</th>
					<td>
						<input name="beginDate" id ="beginDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
							value="<fmt:formatDate value="${student.beginDate}" pattern="yyyy-MM-dd"/>"
							onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
					</td>
					<th>出生截止日期：</th>
					<td colspan="3">
						<input name="endDate" id ="endDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
							value="<fmt:formatDate value="${student.endDate}" pattern="yyyy-MM-dd"/>"
							onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
					</td>
				</tr>
			</table>
		</div>
		<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
		<input id="btnReset" type="button" class="btn btn-primary" value="重置"/>
		<%--<input onclick="down()" class="btn btn-primary" type="button" value="导出"/>
		<input id="btnPrint" class="btn btn-primary" type="button" value="打印"/>--%>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>序号</th>
				<th>姓名</th>
				<th>学号</th>
				<th>年龄（岁）</th>
				<th>性别</th>
				<th>民族</th>
				<th>出生日期</th>
				<th>学校</th>
				<th>年级</th>
				<th>班级</th>
				<th>入学年份</th>
				<th>备注</th>
				<shiro:hasPermission name="student:student:edit"><th>操作</th></shiro:hasPermission>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="student" begin="0" varStatus="status">
			<tr>
			    <td>
					 ${(page.pageNo-1)*page.pageSize+status.index+1 }
				</td>
				<td><a href="${ctx}/student/student/form?id=${student.id}">
					${student.stuName}
				</a></td>
				<td>
					${student.stuCode}
				</td>
				<td>
					${student.age}
				</td>
				<td>
					${fns:getDictLabel(student.gender,'sex','')}
				</td>
				<td>
					${fns:getDictLabel(student.nation,'nation','')}
				</td>
				<td>
					<fmt:formatDate value="${student.birthday}" pattern="yyyy-MM-dd"/>
				</td>
				<td>
					${student.schoolName}
				</td>
				<td>
					${fns:getDictLabel(student.stuGrade,'stu_grade','')}
				</td>
				<td>
					${student.className}
				</td>
				<td>
					${student.enrtYear}
				</td>
				<td>
					${student.remakes}
				</td>
				<shiro:hasPermission name="student:student:edit"><td>
    				<a href="${ctx}/student/student/form?id=${student.id}">修改</a>
					<a href="${ctx}/student/student/delete?id=${student.id}" onclick="return confirmx('确认要删除该学生管理吗？', this.href)">删除</a>
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>